using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter09
{
	/// <summary>
	/// Example04: How Good Are the Bumpers?
	/// In a particular crash test, a car of mass 1500 kg 
	/// collides with a wall, as shown in Figure 9.6. 
	/// The initial and final velocities of the car 
	/// are v_i = -15.0 i m/s and v_f = 2.60 i m/s, 
	/// respectively. If the collision lasts for 0.150 s, 
	/// find the impulse caused by the collision and the 
	/// average force exerted on the car.
	/// I = 2.64 \times 10^4 i kg.m/s
	/// F = 1.76 \times 10^5 i N
	/// </summary>
	public class Example04
	{
		public Example04()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Mass m = new L.Mass();
			m.kg = 1500.0;
			L.Velocity vi = new L.Velocity();
			vi.X = -15.0;
			L.Velocity vf = new L.Velocity();
			vf.X = 2.6;
			L.Momentum pi = new L.Momentum(m,vi);
			L.Momentum pf = new L.Momentum(m,vf);
			L.Impulse I = new L.Impulse(pi,pf);
			L.Time t = new L.Time();
			t.s = 0.15;
			I.ImpactTime = t;
			result+=Convert.ToString(I.X)+"\r\n";
			result+=Convert.ToString(I.AverageForce.X)+"\r\n";
		}
	}
}
